﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Expenses.MvcUI.Infrastructure
{
    public class CultureOutgoingRoute:Route
    {
        public CultureOutgoingRoute(string url,IRouteHandler routeHandler):base(url,routeHandler)
        {

        }
        public CultureOutgoingRoute(string url,RouteValueDictionary defaults, IRouteHandler routeHandler):base(url,defaults,routeHandler)
        {

        }

        public CultureOutgoingRoute(string url,RouteValueDictionary defaults,RouteValueDictionary constraints, IRouteHandler routeHandler):base(url,defaults,constraints,routeHandler)
        {

        }

        public CultureOutgoingRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
            : base(url, defaults, constraints, dataTokens, routeHandler)
        {

        }
        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            if (!values.ContainsKey("Culture"))
            {
                values.Add("Culture", Thread.CurrentThread.CurrentCulture.DisplayName);
            }
            return base.GetVirtualPath(requestContext, values);
        }

    }
}